﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class SendMessage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["UserName"] == null)
        {
            //Response.Redirect("../Login.aspx");
        }

    }
    protected void btnSend_Click1(object sender, EventArgs e)
    {
        ArrayList MessageList = new ArrayList();
        string SendUser = Session["UserName"].ToString();
        string SendMessage = this.txtMessage.Text;
        string SendTime = DateTime.Now.ToString();
        string Message = SendUser + "于" + SendTime + "说：" + SendMessage + "<br><br>";
        if (Application["MessageList"] == null)
        {
            MessageList.Add(Message);
            Application["MessageList"] = MessageList;
        }
        else
        {
            MessageList = (ArrayList)Application["MessageList"];
            MessageList.Add(Message);
            Application["MessageList"] = MessageList;
        }
        this.txtMessage.Text = "";
        this.txtMessage.Focus();
    }
    protected void btnDeleteMessage_Click(object sender, EventArgs e)
    {
        Application.Remove("MessageList");
    }
    protected void btnDeleteUsers_Click1(object sender, EventArgs e)
    {
        Application.Remove("UserList");
        Response.Redirect("../Login.aspx");

    }
}